package com.jk.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jk.model.ProductBean;
import com.jk.model.WuliuBean;
import com.jk.service.CJQService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("cjq")
public class CJQController {

    @Reference(check = false)
    private CJQService cjqService;


    @RequestMapping("getCount")
    @ResponseBody
    public void getCount(){
        int  count =  cjqService.getCount();
        System.out.println(count);

    }


    /**
     * 物流查询
     * @param page
     * @param rows
     * @param wuliuBean
     * @return
     */

    @RequestMapping("findwuliuList")
    @ResponseBody
    public Map findwuliuList(Integer page, Integer rows, WuliuBean wuliuBean){
        return cjqService.findwuliuListt(page,rows,wuliuBean);
    }

    /**
     * 物流查询2
     * @param page
     * @param rows
     * @param wuliuBean
     * @return
     */
    @RequestMapping("findwuliuList2")
    @ResponseBody
    public Map findwuliuList2(Integer page, Integer rows, WuliuBean wuliuBean){
        return cjqService.findwuliuListt2(page,rows,wuliuBean);
    }
    /**
     * 删除用户
     * @param ids
     * @return
     */
    @RequestMapping("delUserById")
    @ResponseBody
    public Boolean delUserById(Integer[] ids){
        try {
            cjqService.delUserById(ids);
            return true;
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }
    /**
     * 是否发货
     * @param
     * @return
     */
    @RequestMapping("sendEmp")
    @ResponseBody
    public Boolean sendEmp(Integer id){
        try {
            cjqService.sendEmp(id);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     *查询商品详情
     * */
    @RequestMapping("findProductListImg")
    @ResponseBody
    public List<ProductBean> findProductListImg(){
        return cjqService.findProductListImg();
    }

    /**
     * 根据id查询商品详情
     * */
    @RequestMapping("queryProductById")
    @ResponseBody
    public List<Map> queryProductById(Integer id){
        return cjqService.queryProductById(id);
    }


    /**
     * 根据id查询商品详情2
     * */
    @RequestMapping("queryProductById2")
    @ResponseBody
    public List<Map> queryProductById2(Integer id){
        return cjqService.queryProductById2(id);
    }



}
